import path, { resolve } from "path"
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    alias: {
      '@': resolve(__dirname,"src")
    }
  },
  server: {
    host: '0.0.0.0',
    proxy: {
      '/api': {
        target: 'http://localhost:3000',
        ws:false,
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, '')
      }
    }
  },
  plugins: [
    react()
  ],
  css: {
    preprocessorOptions: {
       // 定义全局scss变量
       scss: {
        additionalData: `@import "@/style/index.scss";`
      }
    }
  }
})
